package com.lzw.breezeNovel.webApp.controller.user;

import com.lzw.breezeNovel.common.result.Result;
import com.lzw.breezeNovel.model.entity.pojo.user.UserAtten;
import com.lzw.breezeNovel.model.entity.query.PaginationResultQuery;
import com.lzw.breezeNovel.webApp.service.user.UserAttenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 清风明月
 * @Package com.lzw.breezeNovel.webApp.controller.user
 * @date 2025/3/25
 * @description 用户关注
 */
@RestController
@RequestMapping("/app/atten")
@SuppressWarnings("all")
public class UserAttenController {

    /**
     * 用户关注表
     */
    @Autowired
    private UserAttenService userAttenService;

    /**
     * 新增关注
     */
    @RequestMapping("/add")
    public Result add(@RequestParam Long userId,@RequestParam Long ortherId) {
        userAttenService.add(userId,ortherId);
        return Result.ok();
    }

    /**
     * 取消关注
     */
    @RequestMapping("/del")
    public Result del(@RequestParam Long userId,@RequestParam Long ortherId) {
        userAttenService.del(userId,ortherId);
        return Result.ok();
    }

    /**
     * 获取关注列表
     */
    @RequestMapping("/list")
    public Result<PaginationResultQuery<UserAtten>> list(@RequestParam Integer pageNo, @RequestParam Integer size) {
        PaginationResultQuery<UserAtten> userAttenList = userAttenService.list(pageNo, size);
        return Result.ok(userAttenList);
    }


}
